package com.quxue.im.controller;

import com.quxue.im.req.chat.ChatMsgReq;
import com.quxue.im.service.IChatMsgService;
import com.quxue.im.vo.AjaxResult;
import com.quxue.im.vo.chat.ChatMsgVo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 聊天消息 前端控制器
 * </p>
 *
 * @author jinken
 * @since 2023-11-10
 */
@RestController
@RequestMapping("/chat")
public class ChatMsgController {

    @Resource
    private IChatMsgService chatMsgService;

    @RequestMapping("/sendMsg")
    public AjaxResult sendMsg(@RequestBody ChatMsgReq msgReq){
        System.out.println("msgReq = " + msgReq);
        ChatMsgVo result  = chatMsgService.sendFriendMsg(msgReq);

        return AjaxResult.success(result);
    }
}
